<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Getting Started</title>
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="../../../index.html" title="ODTONE 0.3">
<link rel="up" href="../client_index.html" title="Client">
<link rel="prev" href="../client_index.html" title="Client">
<link rel="next" href="../dummyserver_index.html" title="Dummyserver">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="'ODTONE - Open Dot Twenty One'" width="100" height="100" src="../../.././images/logo.png"></td></tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../client_index.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../client_index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../dummyserver_index.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
</div>
<div class="section" title="Getting Started">
<div class="titlepage"><div><div><h4 class="title">
<a name="odtone.app.client_index.client_getStart"></a><a class="link" href="client_getStart.html" title="Getting Started"> Getting Started</a>
</h4></div></div></div>
<div class="section" title="Configuration">
<div class="titlepage"><div><div><h5 class="title">
<a name="odtone.app.client_index.client_getStart.configuration"></a><a class="link" href="client_getStart.html#odtone.app.client_index.client_getStart.configuration" title="Configuration">Configuration</a>
</h5></div></div></div>
<p>
            The configuration of the client consist in defining the IP address and
            the listening port of message's destination.
          </p>
<p>
            The IP address must be configured in a configuration file: 
</p>
<pre class="programlisting"><span class="identifier">ip</span> <span class="special">=</span> <span class="special">&lt;</span><span class="identifier">IP</span> <span class="identifier">address</span><span class="special">&gt;</span>
</pre>
<p>
          </p>
<p>
            The listening port can be configured in two ways:
          </p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
              Passing it directly in command line: 
<pre class="programlisting"><span class="special">--</span><span class="identifier">port</span><span class="special">=&lt;</span><span class="identifier">port</span> <span class="identifier">number</span><span class="special">&gt;</span>
</pre>
</li>
<li class="listitem">
              or configuring it in the configuration file: 
<pre class="programlisting"><span class="identifier">port</span> <span class="special">=</span> <span class="special">&lt;</span><span class="identifier">port</span> <span class="identifier">number</span><span class="special">&gt;</span>
</pre>
</li>
</ul></div>
</div>
<div class="section" title="Extending">
<div class="titlepage"><div><div><h5 class="title">
<a name="odtone.app.client_index.client_getStart.extending"></a><a class="link" href="client_getStart.html#odtone.app.client_index.client_getStart.extending" title="Extending">Extending</a>
</h5></div></div></div>
<p>
            It is possible to add new messages to the <span class="emphasis"><em>client</em></span>
            with only 3 steps:
          </p>
<p>
            <span class="bold"><strong>1st step:</strong></span> Define a new configuration
            option. 
</p>
<pre class="programlisting"><span class="identifier">desc</span><span class="special">.</span><span class="identifier">add_options</span><span class="special">()</span>
	<span class="comment">// ...
</span>	<span class="special">(</span><span class="identifier">kConf_MIH_NewMessage</span><span class="special">,</span> <span class="string">"Send a New Message"</span><span class="special">)</span>
<span class="special">;</span>
</pre>
<p>
          </p>
<p>
            <span class="bold"><strong>2nd step:</strong></span> Add a condition in the main
            function to decide what message send. 
</p>
<pre class="programlisting"><span class="keyword">if</span> <span class="special">(</span><span class="identifier">cfg</span><span class="special">.</span><span class="identifier">count</span><span class="special">(</span><span class="identifier">kConf_MIH_NewMessage</span><span class="special">))</span> <span class="special">{</span>
	<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"sent a new message"</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
	<span class="identifier">send_newMessage</span><span class="special">(</span><span class="identifier">sap</span><span class="special">,</span> <span class="identifier">argv</span><span class="special">[</span><span class="number">1</span><span class="special">]);</span>
<span class="special">}</span>
</pre>
<p>
          </p>
<p>
            <span class="bold"><strong>3rd step:</strong></span> Define function responsible
            to create and send the message.
          </p>
<p>
            
</p>
<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">send_newMessage</span><span class="special">(</span><span class="identifier">handler</span> <span class="special">&amp;</span><span class="identifier">sap</span><span class="special">,</span> <span class="keyword">const</span> <span class="keyword">char</span> <span class="special">*</span><span class="identifier">dst</span><span class="special">)</span>
<span class="special">{</span>
	<span class="identifier">mih</span><span class="special">::</span><span class="identifier">message</span>        <span class="identifier">p</span><span class="special">;</span>

	<span class="comment">//...
</span>	<span class="comment">// Define the message to send here
</span>	<span class="comment">//...
</span>
	<span class="identifier">sap</span><span class="special">.</span><span class="identifier">send</span><span class="special">(</span><span class="identifier">p</span><span class="special">);</span>
<span class="special">}</span>
</pre>
<p>
          </p>
</div>
<div class="section" title="Running">
<div class="titlepage"><div><div><h5 class="title">
<a name="odtone.app.client_index.client_getStart.running"></a><a class="link" href="client_getStart.html#odtone.app.client_index.client_getStart.running" title="Running">Running</a>
</h5></div></div></div>
<p>
            The client must be executed passing directly, in command line, the option
            for the message that will be sent.
          </p>
<p>
            E.g.: ./client --indication.link_up
          </p>
<p>
            By default, message's destination is <span class="emphasis"><em>local-mihf</em></span>.
            However, it is possible to send the message to another destination using
            the <span class="emphasis"><em>--dest</em></span> option, directly in the command line.
          </p>
<p>
            After the <span class="emphasis"><em>client</em></span> send the message the application
            will terminate.
          </p>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2009 -2011 Universidade Aveiro<br>Copyright &#169; 2009 -2011 Instituto de Telecomunica&#231;&#245;es - P&#243;lo Aveiro<p>
        This software is distributed under a license. The full license agreement
        can be found in the LICENSE in this distribution. This software may not be
        copied, modified, sold or distributed other than expressed in the named license
        agreement. This software is distributed without any warranty.
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../client_index.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../client_index.html"><img src="../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../dummyserver_index.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
</div>
</body>
</html>
